﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class webadmin_pages_nguoitimviec_detail : System.Web.UI.Page
{
    public DataRow catdtr;
    private Common comm = new Common();
    public string id = "";
    public string messageError;
    public string sDatetime = "";
    public string sMessage = "0";
    private string sTemp;
    protected void btnOk_Click(object sender, EventArgs e)
    {
        try
        {
            if (string.IsNullOrEmpty(base.ErrorPage))
            {
                if (!string.IsNullOrEmpty(base.Request.QueryString["id"]))
                {
                    this.id = this.comm.TextFormat(base.Request.QueryString["id"]).Trim();
                }
                bool flag1 = this.chkKichHoat.Checked;
                this.sTemp = "update ConNguoi_nguoi";
                this.sTemp = this.sTemp + " set hang_dau=" + (this.chkUuTien.Checked ? "1" : "0");
                this.sTemp = this.sTemp + " ,kich_hoat=" + (this.chkKichHoat.Checked ? "1" : "0");
                this.sTemp = this.sTemp + " ,ht_diachi=" + (this.chkDiaChi.Checked ? "1" : "0");
                this.sTemp = this.sTemp + " ,ht_dienthoai=" + (this.chkDienThoai.Checked ? "1" : "0");
                this.sTemp = this.sTemp + " ,ht_email=" + (this.chkEmail.Checked ? "1" : "0");
                this.sTemp = this.sTemp + " where ma_nguoi='" + this.id + "'";
                if (this.comm.execNoneQuery(this.sTemp) > 0)
                {
                    base.Response.Redirect("nguoitimviec_detail.aspx?id=" + this.id);
                }
                else
                {
                    this.messageError = "Kh\x00f4ng thể cập nhật hoặc th\x00eam mới th\x00f4ng tin n\x00e0y, bạn h\x00e3y xem lại th\x00f4ng tin lỗi nếu c\x00f3 - 1!";
                }
            }
            else
            {
                this.messageError = "Kh\x00f4ng thể cập nhật hoặc th\x00eam mới th\x00f4ng tin n\x00e0y, bạn h\x00e3y xem lại th\x00f4ng tin lỗi nếu c\x00f3 - 2!";
            }
        }
        catch (Exception exception)
        {
            this.messageError = exception.Message.ToString();
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!base.IsPostBack)
            {
                if (!string.IsNullOrEmpty(base.Request.QueryString["id"]))
                {
                    this.id = this.comm.TextFormat(base.Request.QueryString["id"]).Trim();
                }
                if (!string.IsNullOrEmpty(base.Request.QueryString["m"]))
                {
                    this.sMessage = this.comm.TextFormat(base.Request.QueryString["m"]).Trim();
                }
                this.lbl_total.Text = this.comm.execScalar("SELECT COUNT(ma_ho_so) AS tong_so_ho_so FROM dbo.NguoiTimViec_ho_so WHERE ma_nguoi='" + this.id + "'");
                this.sTemp = "SELECT * FROM ConNguoi_nguoi";
                this.sTemp = this.sTemp + " where ma_nguoi='" + this.id + "'";
                this.catdtr = this.comm.getDataTable(this.sTemp).Rows[0];
                this.chkKichHoat.Checked = bool.Parse(this.catdtr["kich_hoat"].ToString());
                this.chkDiaChi.Checked = bool.Parse(this.catdtr["ht_diachi"].ToString());
                this.chkDienThoai.Checked = bool.Parse(this.catdtr["ht_dienthoai"].ToString());
                this.chkEmail.Checked = bool.Parse(this.catdtr["ht_email"].ToString());
                this.chkUuTien.Checked = bool.Parse(this.catdtr["hang_dau"].ToString());
            }
        }
        catch (Exception exception)
        {
            this.messageError = exception.Message.ToString();
        }
    }
}
